#pragma once

#include <typedef.h>
//
#include <msg_rc_raw_s.hpp>
#include <msg_rc_s.hpp>

class RemoterCali
{
public:
	RemoterCali(int state);
	virtual ~RemoterCali();
	virtual void Process(msg_rc_raw_s* rcRaw, msg_rc_s* rc);
	void Reset(void);

protected:
	double CalcValueByParams(uint16_t val, uint16_t min, uint16_t mid, uint16_t max, uint8_t reverse);
	void CalcValueChangedChannel(uint8_t& changeChannel, uint16_t& changeValue, msg_rc_raw_s* rcRaw0, msg_rc_raw_s* rcRaw1);

protected:
	int m_State;
	uint32_t m_Tk;
	uint32_t m_Step;
	uint32_t m_CaliWaitTk;
	uint32_t m_CaliWaitStep;
	double m_CaliFilter;
	double m_RcRawPrev[MSG_RC_E_CNT];
	double m_RcRawCurr[MSG_RC_E_CNT];
	msg_rc_raw_s m_RcRawBegin;
	msg_rc_raw_s m_RcRawEnd;
};